<?php
/**
 * Index.php                后台管理中心首页控制器
 *
 * @author                  mashanling <msl-138@163.com>
 * @date                    2012-06-15 14:38:28
 * @lastmodify             2012-12-29 09:34:54 by mashanling
 */

class IndexController extends BaseController {//继承BaseController by mashanling on 2012-07-02 10:11:37
    protected $_auto_check_priv = false;//是否自动检测权限
    protected $_init_model      = false;//是否实例对应模型

    /**
     * 后台管理中心
     *
     * @author       mashanling
     * @date         2012-07-02 11:12:49
     * @lastmodify  2012-12-18 11:32:57 by mashanling
     *
     * @return bool 未登陆，返回false，否则返回true
     */
    function indexAction() {

        if (!$admin_info = $this->_admin_info) {
            $this->_redirect('login');
            return false;
        }

        $admin_priv = strtolower(json_encode(array_values($this->_role_info['priv'])));
        //css文件
        $css_file  = $this->_loadTimeScript('START_TIME');
        $css_file .= css('extjs/resources/css/ext-all-gray.css,extjs/resources/css/ext-patch.css', IMGCACHE_JS);
        $css_file .= css('app.css');
        $js_file   = $this->_loadTimeScript('LOAD_CSS_TIME');
        $js_file  .= js('');
        $js_file  .= $this->_loadTimeScript('LOAD_EXT_TIME');
        $js_file  .= js('System.js', false, '/static/js/');
        $js_file  .= js(LANG . '.js', false, '/static/js/lang/') .
        //ext语言包
        ('en' != LANG ? js('ext-lang-' . LANG . '.js', false, '/static/js/lang/') : '');

        if (APP_DEBUG) {
            $js_arr = include(APP_PATH . 'include/required_js.php');

            $js_file .= js($js_arr, false, IMGCACHE_JS . 'app/');
        }
        else {
            $js_file .= js('app/pack/app.js', false);
        }

        $js_file  .= $this->_loadTimeScript('LOAD_JS_TIME');

        include(TEMPLATE_FILE);

        return true;
    }
}